
@@include('../common.html')
<script src="/assets/vendors/jquery/jquery-3.6.0.min.js"></script>
<script src="/assets/vendors/art-template/template-web.js"></script>
<script src="/assets/vendors/bootstrap/js/bootstrap.js"></script>
<script src="/assets/vendors/moment/moment.js"></script>

// 为 当前页面 ajax 全局设置 Token

<script>
    $.ajaxSetup({
        beforeSend: function (xhr) {
            const token = localStorage.getItem('token')
            xhr.setRequestHeader('Authorization', token)
        },
        timeout: 10000  // 超时操作

    })

    // 获取用户登录状态
    $.ajax({
        url: `${baseUrl}/login/status`,
        success: function (result) {
            if (result.data && result.data.isLogin) {
                window.userId = result.data.userId
            } else {
                location.href = 'login.html'
            }
        },
        error: function (err) {
            alert('登录失效')
            location.href = 'login.html'
        }


    })


</script>

